#pragma once


#include "Misc/CommonMacros.h"
#include "Widgets/EditableTextWidget.h"
#include "Widgets/RectangleWidget.h"
#include "Widgets/Mouse/MouseWidget.h"
#include "SpinBox.m.h"

// a spin box without background
//when number changed, call OnAccepted delegate
RCLASS()
class WHENGINE_API RSpinBox : public REditableTextWidget
{
    ROBJECT
public:
    RSpinBox();

    void SetNumber(double InNumber);

    RFIELD()
    TScriptDelegate<void(float )> OnNumberAccepted;

    double GetNumber();

    double Delta=1;

    bool bIsInteger = false;

    void SetMinNumber(double InMinNumber);

    void SetMaxNumber(double InMaxNumber);

    

private:

    //REditableTextWidgetPtr Number;

    double InitailNumber;

    double MinNumber=std::numeric_limits<double>::lowest();
    double MaxNumber=std::numeric_limits<double>::max();

};